package lesson02;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

public class TestMain6 {

	public static void main(String[] args) {
		
		Date d = new Date();
		
		System.out.println(d.getYear());
		
		System.out.println(d.getMonth());
		
		// 本地化日期
		LocalDate d1 = LocalDate.now();
		System.out.println(d1);
		
		LocalDateTime d2 = LocalDateTime.now();
		System.out.println(d2);
	
		// 日历类
		Calendar c1 = Calendar.getInstance();
		// 运算：  get/ set / add
		System.out.println(c1.get(Calendar.MONTH));
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		System.out.println(sdf.format(c1.getTime()));
		c1.add(Calendar.DATE, 10);
		System.out.println(sdf.format(c1.getTime()));
		c1.add(Calendar.HOUR, 30);
		System.out.println(sdf.format(c1.getTime()));
	}
}
